#pragma once
#include <memory>
#include "InnerType.h"

namespace xncc {
namespace foundation {
    class XnccAddress;

    class Socket
    {
      public:
        explicit Socket(std::shared_ptr<XnccAddress> addr);
        virtual ~Socket() = default;

        Socket(const Socket&&) = delete;
        Socket(const Socket&)  = delete;

        Socket& operator=(const Socket&)  = delete;
        Socket& operator=(const Socket&&) = delete;

        [[nodiscard]] auto addrType() const -> shared::XNCC_ADDR_TYPE;

        [[nodiscard]] int fd() const { return sockfd_; }

        virtual void bind()                                    = 0;
        virtual void listen()                                  = 0;
        virtual int  accept(std::shared_ptr<XnccAddress> addr) = 0;

      protected:
        const std::shared_ptr<XnccAddress> sockaddr_;
        int                                sockfd_;
    };
}  // namespace foundation
}  // namespace xncc